#pragma once

class ThreadJoin
{
	HANDLE hOrigEvent;
public:
	ThreadJoin() {
		hOrigEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
	}

	~ThreadJoin() {
		CloseHandle(hOrigEvent);
	}

	void join(ui32 timeout = INFINITE) {
		WaitForSingleObject(hOrigEvent, timeout);
	}

	void signal() {
		SetEvent(hOrigEvent);
	}
};